package com.hl.qzzpbackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * @Title: UserRoleEnum
 * @Author  helong
 * @Package com.hl.qzzpbackend.model.enums
 * @Date  2025/1/9 15:27
 * @description: 
*/
@Getter
public enum SendEmailCodeEnum {

    Login("login",0,"用户登录"),
    Register("register",1,"用户注册");

    private final String desc;
    private final String title;
    private final Integer value;

    SendEmailCodeEnum(String desc, Integer value,String title) {
        this.desc = desc;
        this.title = title;
        this.value = value;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static SendEmailCodeEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (SendEmailCodeEnum sendEmailCodeEnum : SendEmailCodeEnum.values()) {
            if (sendEmailCodeEnum.getValue().equals(value)) {
                return sendEmailCodeEnum;
            }
        }
        return null;
    }



}